Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove CliNpmReqResolver trait in deno_resolver #27616

Merged

Conversation

dsherret
Copy link
Member

No description provided.

sys: self.sys(),
in_npm_pkg_checker: self.in_npm_pkg_checker()?.clone(),
node_resolver: self.node_resolver().await?.clone(),
npm_req_resolver: npm_resolver.clone().into_npm_req_resolver(),
npm_resolver: npm_resolver.clone().into_byonm_or_managed(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This into_... is not ideal. I'll refactor the npm_resolver stuff into an enum in the future and see about pushing more of the code down to deno_resolver.

#[class(inherit)]
#[error(transparent)]
ResolvePkgFolderFromPkgId(#[from] ResolvePkgFolderFromPkgIdError),
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from below so it's not inbetween the struct and its implementation.

#[derive(Debug, thiserror::Error, deno_error::JsError)]
pub enum ResolvePkgFolderFromPkgIdError {
#[class(inherit)]
#[error("{0}")]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got rid of these and replaced with error(transparent)

match maybe_node_modules_path {
Some(node_modules_folder) => new_rc(LocalNpmPackageResolver::new(
resolution,
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct is new. More stuff from the CLI will be moved down here in the future.

) -> Option<Ref<'a, V>>
where
K: std::borrow::Borrow<Q>,
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this because I found the crate wasn't compiling again when the sync feature isn't enabled. I think in the future we should add something to the CI to ensure all these crates compile without the sync feature and in Wasm, but atm it's not high priority.

Comment on lines +178 to +183
log::debug!(
"Resolved {} from {} to {}",
specifier,
referrer,
path.display()
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for these debug logs. Makes debugging so much easier!

@dsherret dsherret merged commit c27248a into denoland:main Jan 10, 2025
17 checks passed
@dsherret dsherret deleted the refactor_remove_cli_npm_req_resolver_trait branch January 10, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants